;Settings.au3

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SliderConstants.au3>
#include <GuiSlider.au3>
#Include <GuiButton.au3>
#include <GuiTab.au3>
#include <DateTimeConstants.au3>

Global $_guiSettings, $_guiSettingsGeneralGnomoriaDirInp

Func _guiSettings()
	$_guiSettings = GUICreate("Settings", 717, 461, -1, -1, -1, -1)
	$_guiSettingsTab = GUICtrlCreatetab(10, 50, 694, 365, -1, -1)
	GUICtrlCreateTabItem("General")
	GUICtrlCreateTabItem("Page 2")
	GUICtrlCreateTabItem("")
	_GUICtrlTab_SetCurFocus($_guiSettingsTab, -1)
	GUICtrlCreateLabel("Gnomoria Enhanced Settings", 7, 8, 700, 37, 1, -1)
	GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif")
	$_guiSettingsSaveBtn = GUICtrlCreateButton("Save", 490, 420, 100, 30, -1, -1)
	$_guiSettingsCancelBtn = GUICtrlCreateButton("Cancel", 600, 420, 100, 30, -1, -1)
	GUISwitch($_guiSettings, _GUICtrlTab_SetCurFocus($_guiSettingsTab, 0) & GUICtrlRead($_guiSettingsTab, 1))
	GUICtrlCreateLabel("Gnomoria Directory", 38, 99, 111, 18, 8388609, -1)
	GUICtrlSetBkColor(-1, "0xFFFFFF")
	$_guiSettingsGeneralGnomoriaDirInp = GUICtrlCreateInput($gnomoriaDirectory, 158, 99, 448, 18, -1, 512)
	$_guiSettingsGeneralGnomoriaDirBrowseBtn = GUICtrlCreateButton("Browse", 613, 99, 66, 18, -1, -1)
	GUICtrlCreateGroup("Paths", 28, 79, 661, 144, -1, -1)
	GUICtrlSetOnEvent($_guiSettingsGeneralGnomoriaDirBrowseBtn, "_guiSettingsGeneralGnomoriaDirBrowse")
	GUICtrlSetOnEvent($_guiSettingsCancelBtn, "_guiSettingsClose")
	_GUICtrlTab_SetCurFocus($_guiSettingsTab, 0)
	GUISetState(@SW_SHOW, $_guiSettings)
EndFunc

Func _guiSettingsClose()
	GUIDelete($_guiSettings)
	TraySetState() ; Reset the state of the tray icon
EndFunc ;==>_guiAboutClose

Func _guiSettingsGeneralGnomoriaDirBrowse()
	ConsoleWrite("Select Gnomoria Install Folder..." & @CRLF)
	Local $selected
	Do 
		$selected = FileSelectFolder ("Select Gnomoria Install Folder", $_guiSettingsGeneralGnomoriaDirInp, 6, $_guiSettingsGeneralGnomoriaDirInp)	
		debug("Checking " & $selected & "\Gnomoria.exe" & @CRLF)
	Until FileExists($selected & "\Gnomoria.exe") = 1
	GUICtrlSetData($_guiSettingsGeneralGnomoriaDirInp,$selected)
EndFunc